package artid.com.arttogo.bean;

import org.json.JSONArray;
import org.json.JSONObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 
 * 
 * 项目名称：ArtworkArt 类名称：NewartListParser 类描述：艺术家个人作品图的列表实体类+解析 创建人：耿卫斌
 * 创建时间：2017-1-5 下午3:38:50
 *
 */
public class SelectphraseParser extends AppItem implements Serializable {
	private static final long serialVersionUID = 1L;
	String id;
	String sp_name;
	String sp_field_value;
	List<word> list;

	public List<word> getList() {
		return list;
	}

	public void setList(List<word> list) {
		this.list = list;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getSp_name() {
		return sp_name;
	}

	public void setSp_name(String sp_name) {
		this.sp_name = sp_name;
	}

	public String getSp_field_value() {
		return sp_field_value;
	}

	public void setSp_field_value(String sp_field_value) {
		this.sp_field_value = sp_field_value;
	}

	@Override
	public void parse(JSONObject obj) {
		// TODO Auto-generated method stub
		if (null == obj) {
			return;
		}

		JSONObject spObject = obj;

		list = new ArrayList<word>();
		id = spObject.optString("id");
		sp_field_value = spObject.optString("sp_field_value");
		sp_name = spObject.optString("sp_name");
		JSONArray arrValue = spObject.optJSONArray("sp_value");
		if(arrValue.length()>0){
			for (int j = 0; j < arrValue.length(); j++) {
				JSONObject value = arrValue.optJSONObject(j);
				word vitem = new SelectphraseParser.word();
				vitem.sp_value_id = value.optString("sp_value_id");
				vitem.sp_value_name = value.optString("sp_value_name");
				list.add(vitem);
			}
		}

	}

	public class word {
		String sp_value_id;
		String sp_value_name;

		public String getSp_value_id() {
			return sp_value_id;
		}

		public void setSp_value_id(String sp_value_id) {
			this.sp_value_id = sp_value_id;
		}

		public String getSp_value_name() {
			return sp_value_name;
		}

		public void setSp_value_name(String sp_value_name) {
			this.sp_value_name = sp_value_name;
		}

	}

}
